package com.example.yiwei.crm.view.activity.healthActivity;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.example.yiwei.crm.R;
import com.example.yiwei.crm.data.GetClue;
import com.example.yiwei.crm.entity.ClueMeesageEntity;

import static com.example.yiwei.crm.R.id.health_education_detailed_clue_txt_department;
import static com.example.yiwei.crm.R.id.health_education_detailed_clue_txt_gender;
import static com.example.yiwei.crm.R.id.health_education_detailed_clue_txt_manager;


public class HealthDetailedClueManagerActivity extends AppCompatActivity {
private TextView txt_customer_id,txt_clue_name,txt_gender,txt_age,txt_contact,txt_phone,txt_disease_category,txt_clue_source,txt_department,
    txt_state,txt_right,txt_left,txt_FQ_right,txt_FQ_left,txt_manager,txt_QK,txt_create_time;
    ClueMeesageEntity clueMeesageEntity;
    private String qkjj,YG_right,YG_left,XS_right,XS_left,RS_right,RS_left,other,JZ_right,JZ_left;
    private ImageView img_back;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_health_detailed_clue_manager);
        img_back= (ImageView) findViewById(R.id.detailed_doc_img_back);
        txt_customer_id= (TextView) findViewById(R.id.health_education_detailed_clue_txt_customer_id);
        txt_gender= (TextView) findViewById(health_education_detailed_clue_txt_gender);
        txt_clue_name= (TextView) findViewById(R.id.health_education_detailed_clue_txt_clue_name);
        txt_age= (TextView) findViewById(R.id.health_education_detailed_clue_txt_age);
        txt_contact= (TextView) findViewById(R.id.health_education_detailed_clue_txt_contact_name);
        txt_phone= (TextView) findViewById(R.id.health_education_detailed_clue_txt_phone);
        txt_disease_category= (TextView) findViewById(R.id.health_education_detailed_clue_txt_disease_category);
        txt_clue_source= (TextView) findViewById(R.id.health_education_detailed_clue_txt_clue_source);
        txt_department= (TextView) findViewById(health_education_detailed_clue_txt_department);
        txt_state= (TextView) findViewById(R.id.health_education_detailed_clue_txt_genjin_state);
        txt_right= (TextView) findViewById(R.id.health_education_detailed_clue_txt_right);
        txt_left= (TextView) findViewById(R.id.health_education_detailed_clue_txt_left);
        txt_FQ_right= (TextView) findViewById(R.id.health_education_detailed_clue_txt_FQ_right);
        txt_FQ_left= (TextView) findViewById(R.id.health_education_detailed_clue_txt_FQ_left);
        txt_manager= (TextView) findViewById(health_education_detailed_clue_txt_manager);
        txt_QK= (TextView) findViewById(R.id.health_education_detailed_clue_txt_qkjj);
        txt_create_time= (TextView) findViewById(R.id.health_education_detailed_clue_txt_create_time);
        img_back.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
        clueMeesageEntity= GetClue.get();
        txt_customer_id.setText(clueMeesageEntity.getCustomer_id()+"");
        txt_clue_name.setText(clueMeesageEntity.getClue_name());
        txt_age.setText(clueMeesageEntity.getClue_age()+"");
        if (clueMeesageEntity.getClue_gender()==1){
            txt_gender.setText("男");
        }else if (clueMeesageEntity.getClue_gender()==2){
            txt_gender.setText("女");
        }
        txt_contact.setText(clueMeesageEntity.getClue_contact());
        txt_phone.setText(clueMeesageEntity.getClue_mobile_phone());
        txt_disease_category.setText(clueMeesageEntity.getClue_disease_category());
        txt_clue_source.setText(clueMeesageEntity.getClue_channel_source());
        txt_department.setText(clueMeesageEntity.getClue_department());
        if (clueMeesageEntity.getClue_follow_status()==0){
            txt_state.setText("未联系");
        }else{
            txt_state.setText("已联系");
        }
        txt_right.setText(clueMeesageEntity.getRight_eyes());
        txt_left.setText(clueMeesageEntity.getLeft_eyes());
        txt_FQ_right.setText(clueMeesageEntity.getFQ_right());
        txt_FQ_left.setText(clueMeesageEntity.getFQ_left());
      if (clueMeesageEntity.getJZ_right()==null){
          JZ_right="";
    }else{
          JZ_right=clueMeesageEntity.getJZ_right();
      }
        if (clueMeesageEntity.getJZ_left()==null){
            JZ_left="";
        }else{
            JZ_left=clueMeesageEntity.getJZ_left();
        }
        if (clueMeesageEntity.getYG_right()==null){
            YG_right="";
        }else{
            YG_right=clueMeesageEntity.getYG_right();
        }
        if (clueMeesageEntity.getYG_left()==null){
            YG_left="";
        }else{
            YG_left=clueMeesageEntity.getYG_left();
        }
        if (clueMeesageEntity.getXS_right()==null){
            XS_right="";
        }else{
            XS_right=clueMeesageEntity.getXS_right();
        }
        if (clueMeesageEntity.getXS_left()==null){
            XS_left="";
        }else{
            XS_left=clueMeesageEntity.getXS_left();
        }
        if (clueMeesageEntity.getRS_right()==null){
            RS_right="";
        }else{
            RS_right=clueMeesageEntity.getRS_right();
        }
        if (clueMeesageEntity.getRS_left()==null){
            RS_left="";
        }else{
            RS_left=clueMeesageEntity.getRS_left();
        }

        if (clueMeesageEntity.getOther()==null){
            other="";
        }else{
            other=clueMeesageEntity.getOther();
        }

        if (clueMeesageEntity.getPDYJ()==19){
            qkjj="右眼验光："+YG_right+"    "+"左眼验光："+YG_left+"\n"+ "右眼斜视："+XS_right+"    "+"左眼斜视："+XS_left+"\n"+
                    "右眼弱视："+RS_right+"    "+"左眼弱视："+RS_left;
        }else  if (clueMeesageEntity.getPDYJ()==18){
            qkjj="其他眼病："+other;
        }else{
            qkjj="";
        }
if (qkjj.equals("")){
    txt_QK.setText("右眼矫正："+JZ_right+"  "+"左眼矫正："+JZ_left);
}else{
    txt_QK.setText("右眼矫正："+JZ_right+"  "+"左眼矫正："+JZ_left+"  "+"\n"+qkjj);
 }

        txt_manager.setText(clueMeesageEntity.getClue_manager_name());
        txt_create_time.setText(clueMeesageEntity.getClue_create_time());

    }
}
